#include "GameField.h"

Field::Field(int _numAbs, int _numOrd):
	numAbs(_numAbs),
	numOrd(_numOrd)
{
	Cell** arrayField = new Cell*[numAbs];
	for (int i = 0; i < numAbs; i++)
		arrayField[i] = new Cell[numOrd];
	for (int i = 0; i < numAbs; i++)
		for (int j = 0; j < numOrd; j++)
		{
			Position curPos(i*Cell::getSize().x,j*Cell::getSize().y);
			arrayField[i][j] = Cell(WALL,curPos);	
		}
}

cellType Field::getCellSt(Position _pos)
{
	int xTable = _pos.x/Cell::getSize().x;
	int yTable = _pos.y/Cell::getSize().y;
	return arrayField[xTable][yTable].getCellType();
}

Field::~Field()
{
		for (int i = 0; i < numAbs; i++)
			delete [] arrayField[i];
		delete [] arrayField;
}